package com.weiqiao.mall.repository.impl;

import com.weiqiao.base.dao.impl.BaseMongoDaoImpl;
import com.weiqiao.mall.repository.IStrategyRepository;
import org.bson.Document;
import org.bson.conversions.Bson;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository("StrategyRespository")
public class StrategyRespository extends BaseMongoDaoImpl implements IStrategyRepository {

    private final static String collectionName = "strategy";

    @Override
    public List<String> strategyList(Bson filter, Bson sort, int skip, int limit){
        return super.findFilterSortSkipLimit(collectionName,filter,sort,skip,limit);
    }

    @Override
    public Boolean updateStrategy(Bson filter, Document doc){
        return  super.updateOne(collectionName,filter,doc,false);
    }

    @Override
    public Boolean insertStrategy(String json){
        return super.inSert(collectionName ,json);
    }

    @Override
    public int countStrategy( Bson filters){
        return super.statististics(collectionName,filters);
    }

    @Override
    public String getStrategyInfo(Bson filter) {
        return super.findOne(collectionName, filter);
    }

    @Override
    public Boolean deleteStrategy(Bson filter,Document doc){
        return super.updateOne(collectionName,filter,doc,false);
    }
}
